import React from 'react';
import ReactDOM from 'react-dom';

import { HashRouter as Router, Route, Switch, Redirect } from 'react-router-dom'

import { Provider } from 'mobx-react';

import { Tools, Toast, Bubble } from 'weaver-mobile';

import { FloatingTouch } from 'weaver-mobile-page';

import allStore from './stores';

import { asyncComponent } from 'react-async-component';
import './style';


const coms = {
    Home: asyncComponent({
        resolve: () => import("./components/Home")
    }),
    FormSignIndex: asyncComponent({
        resolve: () => import("./components/formSign/FormSignIndex")  //流程中心
    }),
    CloseWindow: asyncComponent({
        resolve: () => import("./components/formSign/CloseWindow")
    })
}

class Root extends React.Component {
    render() {
        return (
            <Provider {...allStore}>
                <Router>
                    <FloatingTouch onClick={() => this.onHomePageClick()}>
                        <Route name="home" path="/" render={() => {
                            return (
                                <coms.Home>
                                    <Route name="formSign" path="/formSign" component={coms.FormSignIndex} />
                                    <Route name="closeWinodw" path="/closeWindow" component={coms.CloseWindow} />
                                </coms.Home>
                            )
                        }} />
                    </FloatingTouch>
                </Router>
            </Provider>
        )
    }
    onHomePageClick() {
        window.location.href = '/#/';
    }
}

Tools.getLocaleLabel("qiyuesuo4pc", () => { // 多语言
    ReactDOM.render(<Root />, document.getElementById('root'));
});
